const loaderUtils = require('loader-utils')

module.exports = function messageLoader(source) {
    // 获取loader传递过来的参数
    const { name } = this.query
    console.log('source', source)
    console.log('options', this.query)
    // 处理异步情况
    const callback = this.async()
    setTimeout(() => {
        // return source.replace('hello', name)
        this.callback(
            null,
            source.replace('hello', name),
            null,
            null
        )
    }, 2000)
}